/*
 * MIT License
 *
 * Copyright (c) 2020 Mr.css
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package cn.seaboot.postman.request;

import java.util.Arrays;

/**
 * If object, contains the complete broken-down URL for this request. If string, contains the literal request URL.
 *
 * @author Mr.css
 * @date 2020-01-28 10:48
 */
public class Url {
    /**
     * "The string representation of the request URL, including the protocol, host, path, hash, query parameter(s) and path variable(s).
     */
    private String raw;
    /**
     * The protocol associated with the request, E.g: 'http'
     */
    private String protocol;
    /**
     * The complete path of the current url, broken down into segments. A segment could be a string, or a path variable.
     */
    private String[] path;
    /**
     * The host for the URL, E.g: api.your domain.com. Can be stored as a string or as an array of strings.
     */
    private String[] host;
    /**
     * The port number present in this URL. An empty value implies 80/443 depending on whether the protocol field contains http/https.
     */
    private String port;
    private Query[] query;

    public String getRaw() {
        return raw;
    }

    public void setRaw(String raw) {
        this.raw = raw;
    }

    public Query[] getQuery() {
        return query;
    }

    public void setQuery(Query[] query) {
        this.query = query;
    }

    public String[] getHost() {
        return host;
    }

    public void setHost(String[] host) {
        this.host = host;
    }

    public String[] getPath() {
        return path;
    }

    public void setPath(String[] path) {
        this.path = path;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    @Override
    public String toString() {
        return "Url{" +
                "raw='" + raw + '\'' +
                ", protocol='" + protocol + '\'' +
                ", path=" + Arrays.toString(path) +
                ", host=" + Arrays.toString(host) +
                ", port='" + port + '\'' +
                ", query=" + Arrays.toString(query) +
                '}';
    }
}
